package com.atguigu.gmall.item.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.item.service.ItemService;
import com.atguigu.gmall.model.product.SkuInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @program: gmall-parent
 * @author: Mr.Zhuo
 * @create: 2022-04-05 09:48
 **/
@RestController
@RequestMapping("api/item")
public class ItemController {

    @Autowired
    private ItemService itemService;


    /**
     *  根据skuId  查询sku商品详细信息
     * @param skuId
     * @return
     */
    @GetMapping("{skuId}")
    public Result<Map> getBySkuId(@PathVariable Long skuId) {
        // 调用service层方法
        Map<String, Object> result  = itemService.getBySkuId(skuId);

        // 返回数据
        return Result.ok(result) ;
    }
}
